<?php

namespace Sffi\ElementPlus\ElForm;

use Sffi\ElementPlus\entity\Option;
use Sffi\ElementPlus\entityTrait\SelectOption;

class ElTreeSelect extends \Sffi\ElementPlus\ElForm\FormItem
{
    use SelectOption;

    protected string $type = 'treeSelect';
    protected string $placeholder;


    public function __construct($title, $key, $placeholder='请输入', $minLength=0, $maxLength=0)
    {
        $this->placeholder = $placeholder;
        $this->title = $title;
        $this->prop = $key;
        $this->key = $key;
    }

    public function addOptionByArgs(string $key, string $value,bool $disabled=false, $children=[])
    {
        return $this->addOption(new Option($key, $value, $disabled, $children));
    }
}